*** Settings ***
Suite Setup       Start Calculator
Suite Teardown    Stop Calculator
Test Setup        Clear Calculator
Library           AutoItLibrary    ${OUTPUTDIR}    10    ${True}
Library           Collections
Library           String
Variables         CalculatorGUIMap.py
Resource          CalculatorCommon.txt
Resource          Calculator_cn.txt

*** Test Cases ***
Integer Addition
    Click Buttons    42 4 1 + 1 =
    Win Wait    计算器
    ${Ans}=    Get Answer
    Should Be Equal As Numbers    ${Ans}    42

Integer Subtraction
    Click Buttons    4 5 - 3 =
    Win Wait    ${appName}    42
    ${Ans}=    Get Answer
    Should Be Equal As Numbers     ${Ans}     42

Integer Multiplication
    Click Buttons    6 * 7 =
    Win Wait    ${appName}    42
    ${Ans}=    Get Answer
    Should Be Equal As Numbers    ${Ans}    42

Integer Division
    Click Buttons    5 4 6 / 1 3 =
    Win Wait    ${appName}    42
    ${Ans}=    Get Answer
    Should Be Equal As Numbers    ${Ans}    42

Hex Addition
    [Setup]    Set Hex Mode
    Send    DE01F100
    Send    {+}
    Send    ABCDEF
    Send    =
    Win Wait    ${appName}    DEADBEEF
    ${Ans}=    Get Answer
    Should Be Equal As Strings    ${Ans}    DEADBEEF

Hex Subtraction
    [Setup]    Set Hex Mode
    Clip Put    DF598CDE
    Select Calculator Menu Item    Edit Paste
    Win Wait    ${appName}    DF598CDE
    Send    -
    Clip Put    ABCDEF
    Select Calculator Menu Item    Edit Paste
    Win Wait    ${appName}    ABCDEF
    Send    =
    Win Wait    ${appName}    DEADBEEF
    ${Ans}=    Get Answer
    Should Be Equal As Strings    ${Ans}    DEADBEEF

Test Screen Capture On FAIL
    [Tags]    ExpectedFAIL
    [Setup]    Set Hex Mode
    Send    DE01F100
    Send    {+}
    Send    ABCDEF
    Send    =
    Win Wait    ${appName}    3

simple
    Control Click    ${appName}    ${EMPTY}    Button4
    sleep    2s
    Control Click    ${appName}    ${EMPTY}    Button23
    sleep    2s
    Control Click    ${appName}    ${EMPTY}    Button14
    sleep    2s
    Control Click    ${appName}    ${EMPTY}    Button28
    sleep    2s
    Send    {ALTDOWN}
    Sleep    1s
    Send    EC
    Send    {ALTUP}
    ${Answer}=    Clip Get
    sleep    1s
    Should Be Equal As Numbers    ${Answer}    13
